﻿<%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="RssFeed.aspx.cs" Inherits="RssFeed" Title="Untitled Page" MaintainScrollPositionOnPostback="true" %>

<asp:Content ID="Content1" ContentPlaceHolderID="mainContentPlaceHolder" Runat="Server">
	<asp:LinqDataSource ID="LinqDataSource1" runat="server" 
		ContextTypeName="Cgd.Shell.Data.CgdShellDataContext" TableName="RssFeeds" 
		Where="Category=@Category" EnableDelete="True" EnableInsert="True" 
		EnableUpdate="True">
		<WhereParameters>
			<asp:QueryStringParameter Name="Category" QueryStringField="c" Type="Int32" />
		</WhereParameters>
	</asp:LinqDataSource>
	
	<h2>RSS源：<asp:Label ID="lblColumn" runat="server"></asp:Label></h2>
	
	<asp:DataPager ID="DataPager1" runat="server" PagedControlID="ListView1" 
		PageSize="20">
		<Fields>
			<asp:NextPreviousPagerField ShowFirstPageButton="True" 
				ShowNextPageButton="False" ShowPreviousPageButton="False" />
			<asp:NumericPagerField />
			<asp:NextPreviousPagerField ShowLastPageButton="True" 
				ShowNextPageButton="False" ShowPreviousPageButton="False" />
		</Fields>
	</asp:DataPager>
	<asp:ListView ID="ListView1" runat="server" DataKeyNames="Id" 
		DataSourceID="LinqDataSource1" InsertItemPosition="FirstItem" 
		oniteminserting="ListView1_ItemInserting">
		
		<LayoutTemplate>
		<table>
		<tbody id="itemPlaceholder" runat="server"></tbody>
		</table>
		</LayoutTemplate>
		
		<ItemTemplate>
		<tr><td>
		<h3><%# Eval("Title") %></h3>
		<p class="Summary"><%# Eval("Url") %></p>
		<p class="Summary">上次抓取：<%# Eval("LastReadTime") %></p>
		<p class="ItemCommand">
			<asp:LinkButton ID="btnEdit" runat="server" CommandName="Edit" Text="编辑"></asp:LinkButton>
			<asp:LinkButton ID="btnDelete" runat="server" CommandName="Delete" OnClientClick="return confirm('确定要删除吗？\n该操作无法撤销。');" Text="删除"></asp:LinkButton>
		</p>
		</td></tr>
		</ItemTemplate>
		<EditItemTemplate>
		<tr><td class="EditItem">
		<table>
		<tr><td>标题：</td><td><asp:TextBox ID="txtName" runat="server" Text='<%# Bind("Title") %>' Width="600px"></asp:TextBox></td></tr>
		<tr><td>URL：</td><td><asp:TextBox ID="txtUrl" runat="server" Text='<%# Bind("Url") %>' Width="600px"></asp:TextBox></td></tr>
		<tr><td>上次抓取：</td><td><asp:Label ID="lblLastReadTime" runat="server" Text='<%# Eval("LastReadTime") %>'></asp:Label></td></tr>
		</table>
		<p class="ItemCommand">
		<asp:LinkButton ID="btnUpdate" runat="server" CommandName="Update" Text="确定"></asp:LinkButton>
		<asp:LinkButton ID="btnCancel" runat="server" CommandName="Cancel" Text="取消"></asp:LinkButton>
		</p>
		</td></tr>
		</EditItemTemplate>
		<InsertItemTemplate>
		<tr><td class="NewItem">
		<h3>添加RSS源</h3>
		<table>
		<tr><td>标题：</td><td><asp:TextBox ID="txtName" runat="server" Text='<%# Bind("Title") %>' Width="600px"></asp:TextBox></td></tr>
		<tr><td>URL：</td><td><asp:TextBox ID="txtUrl" runat="server" Text='<%# Bind("Url") %>' Width="600px"></asp:TextBox></td></tr>
		<tr><td>抓取时间：</td>
		<td><asp:Calendar ID="Calendar1" runat="server" SelectedDate='<%# Bind("LastReadTime") %>'></asp:Calendar><br />
		<p class="Summary">只抓取这个时间之后的文章。</p>
		</td></tr>
		</table>
		<p class="ItemCommand">
		<asp:LinkButton ID="btnInsert" runat="server" CommandName="Insert" Text="确定"></asp:LinkButton>
		<asp:LinkButton ID="btnCancel" runat="server" CommandName="Cancel" Text="取消"></asp:LinkButton>
		</p>
		</td></tr>
		</InsertItemTemplate>
	</asp:ListView>
	<asp:DataPager ID="DataPager2" runat="server" PagedControlID="ListView1" 
		PageSize="20">
		<Fields>
			<asp:NextPreviousPagerField ShowFirstPageButton="True" 
				ShowNextPageButton="False" ShowPreviousPageButton="False" />
			<asp:NumericPagerField />
			<asp:NextPreviousPagerField ShowLastPageButton="True" 
				ShowNextPageButton="False" ShowPreviousPageButton="False" />
		</Fields>
	</asp:DataPager>
</asp:Content>

